package com.guigusuqi.app.controller;


import com.guigusuqi.app.entity.VO.TimeManagementQuery;
import com.guigusuqi.app.entity.VO.TimeManagementVo;
import com.guigusuqi.app.service.TimeManagementService;
import com.guigusuqi.commonutils.vo.Result;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 时间安排管理 前端控制器
 * </p>
 *
 * @author suqi
 * @since 2022-04-05
 */
@RestController
@RequestMapping("/yy/time-management")
@Api(tags = {"wx-排班小程序Api"})
public class TimeManagementController
{
    @Resource
    private TimeManagementService timeManagementService;

    @ApiOperation(value = "查询所有排班信息")
    @GetMapping("findAll")
    public Result findAllTeacher()
    {
        return Result.success().data("list",timeManagementService.listAll()) ;
    }

    //条件查询
    @ApiOperation(value = "条件查询所有排班信息")
    @PostMapping("TimeManagementCondition")
    public Result pageTeacherCondition(@RequestBody(required = false) TimeManagementQuery timeManagementQuery)
    {
        String time = timeManagementQuery.getTime();
        String officeName = timeManagementQuery.getOfficeName();
        List<TimeManagementVo> timeManagementVos = timeManagementService.conditionList(time,officeName);
        return Result.success().data("item",timeManagementVos);
    }
}

